/**
 * @author LKQ
 * @date 2022/1/10 22:31
 * @description 二分找最大值，最大值一定为峰值
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int findPeakElement(int[] nums) {
        int l = 0, r = nums.length - 1;
        while (l < r) {
            int mid = l + ((r - l) >> 1);
            if (nums[mid] < nums[mid+1]) {
                l = mid + 1;
            } else {
                r = mid;
            }
        }
        return l;
    }
}
